	
// Karakter.h : Declaration of the CKarakter

#ifndef __KARAKTER_H_
#define __KARAKTER_H_

#include "resource.h"       // main symbols
#include "importado.h"
#include "KarakterSkala.h"

/////////////////////////////////////////////////////////////////////////////
// CKarakter
class ATL_NO_VTABLE CKarakter : 
	public CComObjectRootEx<CComMultiThreadModel>,
	public CComCoClass<CKarakter, &CLSID_Karakter>,
	public ISupportErrorInfo,
	public IDispatchImpl<IKarakter, &IID_IKarakter, &LIBID_EBASDLLLib>
{
public:
	CKarakter()
	{
		m_pUnkMarshaler = NULL;
	}
	virtual ~CKarakter()
	{
		if (m_pKarakterSkala)
			m_pKarakterSkala = NULL;
	}

DECLARE_REGISTRY_RESOURCEID(IDR_KARAKTER)
DECLARE_NOT_AGGREGATABLE(CKarakter)
DECLARE_GET_CONTROLLING_UNKNOWN()

DECLARE_PROTECT_FINAL_CONSTRUCT()

BEGIN_COM_MAP(CKarakter)
	COM_INTERFACE_ENTRY(IKarakter)
	COM_INTERFACE_ENTRY(IDispatch)
	COM_INTERFACE_ENTRY(ISupportErrorInfo)
	COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
END_COM_MAP()

	HRESULT FinalConstruct()
	{
		return CoCreateFreeThreadedMarshaler(
			GetControllingUnknown(), &m_pUnkMarshaler.p);
	}

	void FinalRelease()
	{
		m_pUnkMarshaler.Release();
	}

	CComPtr<IUnknown> m_pUnkMarshaler;

// ISupportsErrorInfo
	STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);

// IKarakter
public:
	STDMETHOD(Slet)();
	STDMETHOD(SetInfo)();
	STDMETHOD(get_KarakterSkala)(/*[out, retval]*/ IKarakterSkala **pVal);
	STDMETHOD(put_KarakterSkala)(/*[in]*/ IKarakterSkala *newVal);
	STDMETHOD(get_Karakter)(/*[out, retval]*/ BSTR *pVal);
	STDMETHOD(put_Karakter)(/*[in]*/ BSTR newVal);
	STDMETHOD(get_GUID)(/*[out, retval]*/ BSTR *pVal);
	STDMETHOD(put_GUID)(/*[in]*/ BSTR newVal)
	{
		m_guid = newVal;
		return S_OK;
	}
private:
	bstr_t m_guid, m_karakter;
	IKarakterSkala * m_pKarakterSkala;
};

#endif //__KARAKTER_H_
